﻿using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using IDEAMS.model;
using OxyPlot;
using System.Collections.Generic;
using System.IO;
using A = DocumentFormat.OpenXml.Drawing;
using DW = DocumentFormat.OpenXml.Drawing.Wordprocessing;
using PIC = DocumentFormat.OpenXml.Drawing.Pictures;
using OxyPlot.Wpf;
using IDEAMS.core;
using System;
using System.Linq;
using System.Reflection;
using IDEAMS.model.setting;
using IDEAMS.model.dataAcquisition;
using IDEAMS.model.etalon;

namespace IDEAMS.common
{
    public class CreateReport
    {
        public static void Create(string fileName, DeviceInfo deviceInfo)
        {
            // 创建一个新的Word文档
            using (WordprocessingDocument wordDoc = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))
            {
                // 添加一个主文档部件
                MainDocumentPart mainPart = wordDoc.AddMainDocumentPart();
                mainPart.Document = new Document();
                Body body = mainPart.Document.AppendChild(new Body());

                // 标题前空六行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());


                // 添加标题
                Paragraph paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Center })); // 居中段落
                body.AppendChild(paragraph);
                Run run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("出 厂 检 测 报 告"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (48*2).ToString() };
                run.RunProperties.Bold = new Bold();

                // 七行空行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());

                // 添加产品名称，产品规格，检测时间
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落

                // 创建段落属性
                ParagraphProperties paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                Indentation indentation = new Indentation()
                {
                    FirstLine = "2160" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);

                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("产品名称：光纤光栅便携式解调仪"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落
                // 创建段落属性
                paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                indentation = new Indentation()
                {
                    FirstLine = "2160" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                string type = string.Format("产品规格：{0}", deviceInfo.deviceParam.type);  // 规格型号
                run.AppendChild(new Text(type));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落
                // 创建段落属性
                paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                indentation = new Indentation()
                {
                    FirstLine = "2160" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                string jcTime = string.Format("检测时间：{0}",deviceInfo.testDate.ToString("yyyy年MM月dd日"));
                run.AppendChild(new Text(jcTime));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


                // 11空行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());


                // 单位名称
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Center })); // 居中段落
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("北京通为科技有限公司"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                // 创建一个分页符
                Paragraph pageBreakPara = new Paragraph(new Run(new Break() { Type = BreakValues.Page }));
                body.Append(pageBreakPara);

                // 添加页眉
                AddHeaderWithImage(mainPart, "IDEAMS.resources.images.tw.png");


                #region 第一个表格
                // 添加产品信息表格
                Table table = body.AppendChild(new Table());

                #region 表格属性
                // 创建表格属性
                TableProperties tableProperties = new TableProperties();

                #region 表格宽度
                // 创建表格宽度属性
                TableWidth tableWidth = new TableWidth()
                {
                    Width = "5000", // 表格宽度，单位为twips（1/20点）
                    Type = TableWidthUnitValues.Pct // 宽度单位，这里设置为百分比
                };
                // 将表格宽度属性添加到表格属性中
                tableProperties.Append(tableWidth);
                #endregion

                #region 表格边框
                // 创建表格边框
                TableBorders tableBorders = new TableBorders();

                // 定义边框样式
                Border borderStyle = new Border()
                {
                    Val = BorderValues.Single, // 单实线
                    Size = 4, // 边框宽度，单位为1/8点
                    Color = "000000", // 边框颜色，黑色
                    Space = new UInt32Value((uint)24) // 边框与内容之间的空间，单位为pt
                };

                // 应用边框样式到所有边框
                tableBorders.TopBorder = new TopBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.BottomBorder = new BottomBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.LeftBorder = new LeftBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.RightBorder = new RightBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideHorizontalBorder = new InsideHorizontalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideVerticalBorder = new InsideVerticalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };

                // 将表格边框添加到表格属性中
                tableProperties.Append(tableBorders);
                #endregion

                // 将表格属性添加到表格中
                table.AppendChild<TableProperties>(tableProperties);

                #endregion


                // 添加第一行
                TableRow tableRow = table.AppendChild(new TableRow());
                TableCell tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                TableCellMargin margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                TableCellProperties cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                RunProperties runProperties = new RunProperties();
                FontSize fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                Text text = new Text("产品名称");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                TableCellVerticalAlignment cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("光纤光栅解调仪");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("产品型号规格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                type = deviceInfo.deviceParam.type; // 设备型号
                text = new Text(type);
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                // 添加第二行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("设备序列号");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                string serialNo = deviceInfo.serialNo;
                text = new Text(serialNo);
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("IP地址");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                cellProperties.Append(margin);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("10.0.0.122");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                tableCell.AppendChild(paragraph);
                #endregion

                // 2空行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());

                #region 创建编号
                // 创建编号定义
                NumberingDefinitionsPart numberingPart = mainPart.NumberingDefinitionsPart;
                if (numberingPart == null)
                {
                    numberingPart = mainPart.AddNewPart<NumberingDefinitionsPart>();
                    Numbering rootNumbering = new Numbering();
                    rootNumbering.Save(numberingPart);
                }

                // 创建AbstractNum实例
                AbstractNum abstractNum = new AbstractNum() { AbstractNumberId = 1 };
                numberingPart.Numbering.Append(abstractNum);

                // 创建Level实例并添加到AbstractNum
                Level level = new Level() { LevelIndex = 0 };
                level.StartNumberingValue = new StartNumberingValue() { Val = 1 };
                level.NumberingFormat = new NumberingFormat() { Val = NumberFormatValues.Decimal };
                level.LevelText = new LevelText() { Val = "%1." };
                level.LevelJustification = new LevelJustification() { Val = LevelJustificationValues.Left };

                // 创建ParagraphProperties实例并添加到Level
                paragraphProperties = new ParagraphProperties();
                level.Append(paragraphProperties);

                // 创建Indentation实例并添加到ParagraphProperties
                indentation = new Indentation()
                {
                    Left = "180", // 这是左侧缩进量，单位是twips
                    Hanging = "90" // 这是悬挂缩进量，单位是twips
                };
                paragraphProperties.Append(indentation);

                // 创建RunProperties实例并添加到Level
                runProperties = new RunProperties();
                level.Append(runProperties);

                // 设置字体大小
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位是半点（1/1440英寸）
                runProperties.Append(fontSize);

                // 设置字体名称（如果需要）
                RunFonts runFonts = new RunFonts() { Ascii = "Calibri" };
                runProperties.Append(runFonts);

                // 添加其他必要的Level属性...

                abstractNum.Append(level);

                // 保存NumberingDefinitionsPart
                numberingPart.Numbering.Save();

                // 创建NumberingInstance并关联到AbstractNum
                NumberingInstance numberingInstance = new NumberingInstance() { NumberID = 1 };
                numberingInstance.AbstractNumId = new AbstractNumId() { Val = 1 };
                numberingPart.Numbering.Append(numberingInstance);
                numberingPart.Numbering.Save();

                #endregion


                // 1.外观检测
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                paragraphProperties = new ParagraphProperties();
                NumberingProperties numberingProperties = new NumberingProperties();
                numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                numberingProperties.NumberingId = new NumberingId() { Val = 1 };
                paragraphProperties.Append(numberingProperties);
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("外观检测"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                #region 外观检测表格

                // 添加产品信息表格
                table = body.AppendChild(new Table());

                #region 表格属性
                // 创建表格属性
                tableProperties = new TableProperties();

                #region 表格宽度
                // 创建表格宽度属性
                tableWidth = new TableWidth()
                {
                    Width = "5000", // 表格宽度，单位为twips（1/20点）
                    Type = TableWidthUnitValues.Pct // 宽度单位，这里设置为百分比
                };
                // 将表格宽度属性添加到表格属性中
                tableProperties.Append(tableWidth);
                #endregion

                #region 表格边框
                // 创建表格边框
                tableBorders = new TableBorders();

                // 定义边框样式
                borderStyle = new Border()
                {
                    Val = BorderValues.Single, // 单实线
                    Size = 4, // 边框宽度，单位为1/8点
                    Color = "000000", // 边框颜色，黑色
                    Space = new UInt32Value((uint)24) // 边框与内容之间的空间，单位为pt
                };

                // 应用边框样式到所有边框
                tableBorders.TopBorder = new TopBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.BottomBorder = new BottomBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.LeftBorder = new LeftBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.RightBorder = new RightBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideHorizontalBorder = new InsideHorizontalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideVerticalBorder = new InsideVerticalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };

                // 将表格边框添加到表格属性中
                tableProperties.Append(tableBorders);
                #endregion

                // 将表格属性添加到表格中
                table.Append(tableProperties);

                #endregion

                #region 第一行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                Shading shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                TableCellWidth tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("序号");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                Justification justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("技  术  指  标  要  求");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("结论");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #region 第二行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("1");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("外观无破损、划伤；螺丝齐全、安装到位");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #region 第三行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("2");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("型号、数量要求");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #region 第四行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("3");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("包装符合要求");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #region 第五行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("4");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("配件齐全");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #region 第六行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("5");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "3600", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("光纤端面正常");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "700", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                #endregion

                #endregion

                // 2空行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());

                // 2.产品关键指标测试
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                paragraphProperties = new ParagraphProperties();
                numberingProperties = new NumberingProperties();
                numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                numberingProperties.NumberingId = new NumberingId() { Val = 1 };
                paragraphProperties.Append(numberingProperties);
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("产品关键指标测试"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                #region 2.产品关键指标测试表
                // 添加产品信息表格
                table = body.AppendChild(new Table());

                #region 表格属性
                // 创建表格属性
                tableProperties = new TableProperties();

                #region 表格宽度
                // 创建表格宽度属性
                tableWidth = new TableWidth()
                {
                    Width = "5000", // 表格宽度，单位为twips（1/20点）
                    Type = TableWidthUnitValues.Pct // 宽度单位，这里设置为百分比
                };
                // 将表格宽度属性添加到表格属性中
                tableProperties.Append(tableWidth);
                #endregion

                #region 表格边框
                // 创建表格边框
                tableBorders = new TableBorders();

                // 定义边框样式
                borderStyle = new Border()
                {
                    Val = BorderValues.Single, // 单实线
                    Size = 4, // 边框宽度，单位为1/8点
                    Color = "000000", // 边框颜色，黑色
                    Space = new UInt32Value((uint)24) // 边框与内容之间的空间，单位为pt
                };

                // 应用边框样式到所有边框
                tableBorders.TopBorder = new TopBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.BottomBorder = new BottomBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.LeftBorder = new LeftBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.RightBorder = new RightBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideHorizontalBorder = new InsideHorizontalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideVerticalBorder = new InsideVerticalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };

                // 将表格边框添加到表格属性中
                tableProperties.Append(tableBorders);
                #endregion

                // 将表格属性添加到表格中
                table.Append(tableProperties);

                #endregion

                #region 第一行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("序号");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("技  术  指  标  要  求");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("单位");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("符合指标");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("结论");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion


                #region 第二行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("1");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("工作电流");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("A");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("1.2");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第三行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("2");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("通道出光功率");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("dBm");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("-9");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第四行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("3");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("可重复性测试");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("pm");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("2");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第五行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("4");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("扫描频率");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("Hz");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                int frequency = deviceInfo.frequency;  // 扫描频率
                text = new Text(frequency.ToString());
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第六行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("5");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("波长脉宽");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("nm");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1000", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("41");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #endregion


                // 创建一个分页符
                pageBreakPara = new Paragraph(new Run(new Break() { Type = BreakValues.Page }));
                body.Append(pageBreakPara);

                // 3.产品功能测试
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                paragraphProperties = new ParagraphProperties();
                numberingProperties = new NumberingProperties();
                numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                numberingProperties.NumberingId = new NumberingId() { Val = 1 };
                paragraphProperties.Append(numberingProperties);
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("产品功能测试"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


                #region 产品功能测试表格
                // 添加产品信息表格
                table = body.AppendChild(new Table());

                #region 表格属性
                // 创建表格属性
                tableProperties = new TableProperties();

                #region 表格宽度
                // 创建表格宽度属性
                tableWidth = new TableWidth()
                {
                    Width = "5000", // 表格宽度，单位为twips（1/20点）
                    Type = TableWidthUnitValues.Pct // 宽度单位，这里设置为百分比
                };
                // 将表格宽度属性添加到表格属性中
                tableProperties.Append(tableWidth);
                #endregion

                #region 表格边框
                // 创建表格边框
                tableBorders = new TableBorders();

                // 定义边框样式
                borderStyle = new Border()
                {
                    Val = BorderValues.Single, // 单实线
                    Size = 4, // 边框宽度，单位为1/8点
                    Color = "000000", // 边框颜色，黑色
                    Space = new UInt32Value((uint)24) // 边框与内容之间的空间，单位为pt
                };

                // 应用边框样式到所有边框
                tableBorders.TopBorder = new TopBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.BottomBorder = new BottomBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.LeftBorder = new LeftBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.RightBorder = new RightBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideHorizontalBorder = new InsideHorizontalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
                tableBorders.InsideVerticalBorder = new InsideVerticalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };

                // 将表格边框添加到表格属性中
                tableProperties.Append(tableBorders);
                #endregion

                // 将表格属性添加到表格中
                table.Append(tableProperties);

                #endregion

                #region 第一行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("序号");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1900", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("测试项目");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2100", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("符合标准");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 创建一个Shading对象并设置背景颜色
                shading = new Shading()
                {
                    Val = ShadingPatternValues.Clear,
                    Color = "auto",
                    Fill = "CFCECE" // 红色背景，格式为灰色
                };
                cellProperties.Append(shading);
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("结论");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第二行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties(); 
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("1");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1900", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("POWER指示灯（绿）");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2100", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("开机后灯亮");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第三行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("2");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1900", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("READY指示灯");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2100", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("上电约30s，常亮");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #region 第四行
                // 添加第一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("3");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "1900", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("CONNECT指示灯");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);

                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "2100", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("网线连接上位机，常亮");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Left };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);
                #endregion

                #endregion


                // 2空行
                body.AppendChild(new Paragraph());
                body.AppendChild(new Paragraph());

                // 4.功能测试
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                paragraphProperties = new ParagraphProperties();
                numberingProperties = new NumberingProperties();
                numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                numberingProperties.NumberingId = new NumberingId() { Val = 1 };
                paragraphProperties.Append(numberingProperties);
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("功能测试"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


                #region 创建编号
                // 创建编号定义
                numberingPart = mainPart.NumberingDefinitionsPart;
                if (numberingPart == null)
                {
                    numberingPart = mainPart.AddNewPart<NumberingDefinitionsPart>();
                    Numbering rootNumbering = new Numbering();
                    rootNumbering.Save(numberingPart);
                }

                // 创建AbstractNum实例
                abstractNum = new AbstractNum() { AbstractNumberId = 2 };
                numberingPart.Numbering.Append(abstractNum);

                // 创建Level实例并添加到AbstractNum
                level = new Level() { LevelIndex = 0 };
                level.StartNumberingValue = new StartNumberingValue() { Val = 1 };
                level.NumberingFormat = new NumberingFormat() { Val = NumberFormatValues.Decimal };
                level.LevelText = new LevelText() { Val = "%1)" };
                level.LevelJustification = new LevelJustification() { Val = LevelJustificationValues.Left };

                // 创建ParagraphProperties实例并添加到Level
                paragraphProperties = new ParagraphProperties();
                level.Append(paragraphProperties);

                // 创建Indentation实例并添加到ParagraphProperties
                indentation = new Indentation()
                {
                    Left = "180", // 这是左侧缩进量，单位是twips
                    Hanging = "90" // 这是悬挂缩进量，单位是twips
                };
                paragraphProperties.Append(indentation);

                // 创建RunProperties实例并添加到Level
                runProperties = new RunProperties();
                level.Append(runProperties);

                // 设置字体大小
                fontSize = new FontSize() { Val = "32" }; // 字体大小，单位是半点（1/1440英寸）
                runProperties.Append(fontSize);

                // 设置字体名称（如果需要）
                runFonts = new RunFonts() { Ascii = "Calibri" };
                runProperties.Append(runFonts);

                // 添加其他必要的Level属性...

                abstractNum.Append(level);

                // 保存NumberingDefinitionsPart
                numberingPart.Numbering.Save();

                // 创建NumberingInstance并关联到AbstractNum
                numberingInstance = new NumberingInstance() { NumberID = 2 };
                numberingInstance.AbstractNumId = new AbstractNumId() { Val = 2 };
                numberingPart.Numbering.Append(numberingInstance);
                numberingPart.Numbering.Save();

                #endregion


                #region 获取光谱文件
                Dictionary<string, string> spectrumPathDic = new Dictionary<string, string>();
                string spectrumPath = string.Format(TW_App.fileManager.spectrumPath, deviceInfo.serialNo);
                // 获取文件夹中的所有文件
                string[] files = Directory.GetFiles(spectrumPath);
                foreach (var item in files)
                {
                    // 获取文件的扩展名
                    string fileExtension = Path.GetExtension(item);
                    if (!".bin".Equals(fileExtension))
                    {
                        continue;
                    }

                    // 获取不带扩展名的文件名
                    string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item);
                    string[] fileNames = fileNameWithoutExtension.Split('_');
                    if (fileNames.Length != 3)
                    {
                        continue;
                    }

                    spectrumPathDic.Add(fileNames[1] + "_" + fileNames[2], item);

                }
                #endregion

                GlobalSetting setting = new GlobalSetting();
                setting.Load(serialNo);
                PrintStatus printStatus = new PrintStatus();
                printStatus.Load(serialNo);

                for (int i = 0; i < setting.inspectionSequences.Count; i++)
                {
                    ProcessStep step = (ProcessStep)setting.inspectionSequences[i];
                    switch (step)
                    {
                        case ProcessStep.PRE_DATA_ACQUISITION:
                            CreateDataAcquisitionChart(mainPart, body, deviceInfo, "采集数据（烤机前）", ProcessStep.PRE_DATA_ACQUISITION);
                            break;
                        case ProcessStep.PRE_ETALON:
                            if (printStatus.preEtalon)
                            {
                                CreateEtalonTable(mainPart, body, deviceInfo, "标准具检测（烤机前）", ProcessStep.PRE_ETALON);
                            }
                            break;
                        case ProcessStep.PRE_SPECTRUM_GRATING:
                            CreateSpectrumChart(mainPart, body,deviceInfo, "有光栅光谱（烤机前）",spectrumPathDic,ProcessStep.PRE_SPECTRUM_GRATING);
                            break;
                        case ProcessStep.PRE_SPECTRUM_NO_GRATING:
                            CreateSpectrumChart(mainPart, body, deviceInfo, "无光栅光谱（烤机前）", spectrumPathDic, ProcessStep.PRE_SPECTRUM_NO_GRATING);
                            break;
                        case ProcessStep.CONTINUOUS_DETECTION:
                            CreateContinuousDetection(mainPart, body, deviceInfo, "烤机检测", ProcessStep.CONTINUOUS_DETECTION);
                            break;
                        case ProcessStep.POST_SPECTRUM_NO_GRATING:
                            CreateSpectrumChart(mainPart, body, deviceInfo, "无光栅光谱（烤机后）", spectrumPathDic, ProcessStep.POST_SPECTRUM_NO_GRATING);
                            break;
                        case ProcessStep.POST_SPECTRUM_GRATING:
                            CreateSpectrumChart(mainPart, body, deviceInfo, "有光栅光谱（烤机后）", spectrumPathDic, ProcessStep.POST_SPECTRUM_GRATING);
                            break;
                        case ProcessStep.POST_ETALON:
                            if (printStatus.postEtalon)
                            {
                                CreateEtalonTable(mainPart, body, deviceInfo, "标准具检测（烤机后）", ProcessStep.POST_ETALON);
                            }
                            break;
                        case ProcessStep.POST_DATA_ACQUISITION:
                            CreateDataAcquisitionChart(mainPart, body, deviceInfo, "采集数据（烤机后）", ProcessStep.POST_DATA_ACQUISITION);
                            break;
                        default:
                            break;
                    }
                }


                #region  注释

                //// 2)有光栅光谱TV1600-模块图：
                //paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                //paragraphProperties = new ParagraphProperties();
                //numberingProperties = new NumberingProperties();
                //numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                //numberingProperties.NumberingId = new NumberingId() { Val = 2 };
                //paragraphProperties.Append(numberingProperties);
                //paragraph.Append(paragraphProperties);
                //body.AppendChild(paragraph);
                //run = paragraph.AppendChild(new Run());
                //run.AppendChild(new Text("有光栅光谱TV1600-模块图："));
                //run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                //run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                //// TODO 有光栅光谱图
                //#region 图表
                //int channelNo = 0;
                //if (spectrumPathDic.ContainsKey("0_3"))
                //{
                //    spectrumData = spectrumPathDic["0_3"];
                //    channelNo = 0;
                //}
                //else
                //{
                //    for (int i = 0; i < deviceInfo.deviceParam.nChannel; i++)
                //    {
                //        if (spectrumPathDic.ContainsKey((i + 1) + "_3"))
                //        {
                //            spectrumData = spectrumPathDic[(i + 1) + "_3"];
                //            channelNo = i + 1;
                //            break;
                //        }
                //    }
                //}
                //// 创建 OxyPlot 图表模型
                //model = new PlotModel { Title = "有光栅光谱" };

                //// 设置图例位置和放置方式
                //model.LegendPosition = LegendPosition.RightTop; // 图例位于右上角
                //model.LegendPlacement = LegendPlacement.Outside; // 图例放置在图表外部

                //xAxis = new OxyPlot.Axes.LinearAxis
                //{
                //    Position = OxyPlot.Axes.AxisPosition.Bottom,
                //    Title = "波长（pm）",
                //    // 设置刻度标签格式为小数点后两位
                //    //StringFormat = "0.00"
                //};

                //model.Axes.Add(xAxis);

                //yAxis = new OxyPlot.Axes.LinearAxis
                //{
                //    Position = OxyPlot.Axes.AxisPosition.Left,
                //    Minimum = -75,  // 设置Y轴的最小值
                //    Maximum = 0, // 设置Y轴的最大值,
                //    MajorStep = 5,  // 设置主要刻度间隔
                //    Title = "强度（dBm）",
                //    //AxisTickToLabelDistance = 20, // 设置标签距离轴的距离，单位是屏幕像素
                //    AxisTitleDistance = 20
                //};

                //model.Axes.Add(yAxis);

                //if (channelNo == 0)
                //{
                //    using (FileStream fileStream = new FileStream(spectrumData, FileMode.Open, FileAccess.Read))
                //    {
                //        // 创建BinaryReader实例
                //        using (BinaryReader br = new BinaryReader(fileStream))
                //        {

                //            int channelNum = br.ReadInt32();
                //            for (int m = 0; m < channelNum; m++)
                //            {
                //                List<DataPoint> dataPoints = new List<DataPoint>();
                //                int cNo = br.ReadInt32();
                //                int dataCount = br.ReadInt32();
                //                //long count = fileStream.Length/16;
                //                for (long i = 0; i < dataCount; i++)
                //                {
                //                    DataPoint point = new DataPoint(br.ReadDouble(), br.ReadDouble());
                //                    dataPoints.Add(point);
                //                }

                //                series = new OxyPlot.Series.LineSeries
                //                {
                //                    Title = "通道" + cNo,
                //                    MarkerType = MarkerType.None,
                //                    ItemsSource = dataPoints
                //                };
                //                model.Series.Add(series);
                //            }

                //        }
                //    }
                //}
                //else
                //{
                //    List<DataPoint> dataPoints = new List<DataPoint>();
                //    using (FileStream fileStream = new FileStream(spectrumData, FileMode.Open, FileAccess.Read))
                //    {
                //        // 创建BinaryReader实例
                //        using (BinaryReader br = new BinaryReader(fileStream))
                //        {
                //            int channelNum = br.ReadInt32();
                //            int cNo = br.ReadInt32();
                //            int dataCount = br.ReadInt32();
                //            //long count = fileStream.Length/16;
                //            for (long i = 0; i < dataCount; i++)
                //            {
                //                DataPoint point = new DataPoint(br.ReadDouble(), br.ReadDouble());
                //                dataPoints.Add(point);
                //            }

                //            series = new OxyPlot.Series.LineSeries
                //            {
                //                Title = "通道" + cNo,
                //                MarkerType = MarkerType.None,
                //                ItemsSource = dataPoints
                //            };
                //            model.Series.Add(series);
                //        }
                //    }
                //}

                ////series = new OxyPlot.Series.LineSeries
                ////{
                ////    MarkerType = MarkerType.Circle,
                ////    ItemsSource = new List<DataPoint>
                ////    {
                ////        new DataPoint(0, 0),
                ////        new DataPoint(10, 20),
                ////        new DataPoint(20, 30)
                ////    }
                ////};
                ////model.Series.Add(series);

                //// 将图表渲染为图片
                //using (var stream = new MemoryStream())
                //{
                //    var pngExporter = new PngExporter { Width = 800, Height = 300, Background = OxyColors.White };
                //    pngExporter.Export(model, stream);
                //    stream.Position = 0; // 重置流的位置到开头

                //    // 添加图片部分
                //    ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png);
                //    imagePart.FeedData(stream);

                //    // 获取图片部分的关系ID
                //    string relId = mainPart.GetIdOfPart(imagePart);

                //    // 页面宽度（8.5英寸）转换为EMU
                //    long pageWidthEmu = (long)(5.8 * 914400); // 8.5 inches in EMU

                //    // 计算图片的高度以保持宽高比
                //    long imageHeightEmu = (long)((double)pageWidthEmu / 800 * 300); // 保持宽高比

                //    // 创建内联图形
                //    DW.Inline inline = new DW.Inline(
                //        new DW.Extent() { Cx = pageWidthEmu, Cy = imageHeightEmu }, // 宽度和高度，单位为EMU
                //        new DW.EffectExtent()
                //        {
                //            LeftEdge = 0L,
                //            TopEdge = 0L,
                //            RightEdge = 0L,
                //            BottomEdge = 0L
                //        },
                //        new DW.DocProperties()
                //        {
                //            Id = (UInt32Value)1U,
                //            Name = "Chart Image"
                //        },
                //        new DW.NonVisualGraphicFrameDrawingProperties(
                //            new A.GraphicFrameLocks() { NoChangeAspect = true }),
                //        new A.Graphic(
                //            new A.GraphicData(
                //                new PIC.Picture(
                //                    new PIC.NonVisualPictureProperties(
                //                        new PIC.NonVisualDrawingProperties()
                //                        {
                //                            Id = (UInt32Value)0U,
                //                            Name = "Chart Image.png"
                //                        },
                //                        new PIC.NonVisualPictureDrawingProperties()),
                //                    new PIC.BlipFill(
                //                        new A.Blip(new A.BlipExtensionList(
                //                            new A.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }))
                //                        {
                //                            Embed = relId,
                //                            CompressionState = A.BlipCompressionValues.Print
                //                        },
                //                        new A.Stretch(new A.FillRectangle())),
                //                    new PIC.ShapeProperties(
                //                        new A.Transform2D(
                //                            new A.Offset() { X = 0L, Y = 0L },
                //                            new A.Extents() { Cx = 914400L, Cy = 685800L }),
                //                        new A.PresetGeometry(new A.AdjustValueList()) { Preset = A.ShapeTypeValues.Rectangle }))
                //            )
                //            { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }
                //        )
                //)
                //    { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)0U, DistanceFromRight = (UInt32Value)0U, EditId = "50D07946" };

                //    // 创建一个段落并添加内联图形
                //    Paragraph para = new Paragraph(new Run(new Drawing(inline)));
                //    mainPart.Document.Body.Append(para);

                //}

                //#endregion


                //// 创建一个分页符
                //pageBreakPara = new Paragraph(new Run(new Break() { Type = BreakValues.Page }));
                //body.Append(pageBreakPara);


                //// 3)光谱波长列表：
                //paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                //paragraphProperties = new ParagraphProperties();
                //numberingProperties = new NumberingProperties();
                //numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                //numberingProperties.NumberingId = new NumberingId() { Val = 2 };
                //paragraphProperties.Append(numberingProperties);
                //paragraph.Append(paragraphProperties);
                //body.AppendChild(paragraph);
                //run = paragraph.AppendChild(new Run());
                //run.AppendChild(new Text("光谱波长列表："));
                //run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                //run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                //#region 图表

                //// 创建 OxyPlot 图表模型
                //PlotModel model = new PlotModel { Title = "波长" };

                //// 设置图例位置和放置方式
                //model.LegendPosition = LegendPosition.TopRight; // 图例位于右上角
                //model.LegendPlacement = LegendPlacement.Outside; // 图例放置在图表外部

                ////xAxis = new OxyPlot.Axes.LinearAxis
                ////{
                ////    Position = OxyPlot.Axes.AxisPosition.Bottom,
                ////    Title = "波长（pm）",
                ////    // 设置刻度标签格式为小数点后两位
                ////    //StringFormat = "0.00"
                ////};

                ////model.Axes.Add(xAxis);

                //string waveLenFile = string.Format(TW_App.fileManager.waveLenFile, deviceInfo.serialNo);
                //string waveLenFinishFile = waveLenFile.Replace("waveLen.txt","waveLen_Finish.txt");
                //string dataFile = "";
                //if (File.Exists(waveLenFinishFile))
                //{
                //    dataFile = waveLenFinishFile;
                //}else if (File.Exists(waveLenFile))
                //{
                //    dataFile = waveLenFile;
                //}


                //double minValue = double.MaxValue;
                //double maxValue = double.MinValue;
                //if (!string.IsNullOrEmpty(dataFile))
                //{
                //    List<DataPoint> dataPoints = new List<DataPoint>();
                //    long index = 0;

                //    try
                //    {
                //        using (StreamReader sr = new StreamReader(dataFile))
                //        {
                //            string line;
                //            while ((line = sr.ReadLine()) != null)
                //            {
                //                string[] waves = line.Split('\t');
                //                if (waves.Length > 4)
                //                {
                //                    channelNo = int.Parse(waves[1].ToString());
                //                    double v = double.Parse(waves[3]);
                //                    if(v < minValue) minValue = v;
                //                    if (v > maxValue) maxValue = v;
                //                    dataPoints.Add(new DataPoint(index, v));
                //                    index++;

                //                }
                //            }
                //        }
                //    }
                //    catch (Exception)
                //    {
                //    }

                //    series = new OxyPlot.Series.LineSeries
                //    {
                //        Title = "通道" + channelNo+"光栅1",
                //        MarkerType = MarkerType.None,
                //        ItemsSource = dataPoints
                //    };
                //    model.Series.Add(series);
                //}

                //double diff = maxValue - minValue;

                //yAxis = new OxyPlot.Axes.LinearAxis
                //{
                //    Position = OxyPlot.Axes.AxisPosition.Left,
                //    Minimum = minValue - diff*0.1,  // 设置Y轴的最小值
                //    Maximum = maxValue + diff * 0.1, // 设置Y轴的最大值,
                //    MajorStep = 0.001,  // 设置主要刻度间隔
                //    Title = "波长（pm）",
                //    //AxisTickToLabelDistance = 20, // 设置标签距离轴的距离，单位是屏幕像素
                //    AxisTitleDistance = 20,
                //    StringFormat = "0.000"
                //};
                //model.Axes.Add(yAxis);

                ////series = new OxyPlot.Series.LineSeries
                ////{
                ////    MarkerType = MarkerType.Circle,
                ////    ItemsSource = new List<DataPoint>
                ////    {
                ////        new DataPoint(0, 0),
                ////        new DataPoint(10, 20),
                ////        new DataPoint(20, 30)
                ////    }
                ////};
                ////model.Series.Add(series);

                //// 将图表渲染为图片
                //using (var stream = new MemoryStream())
                //{
                //    var pngExporter = new PngExporter { Width = 800, Height = 300, Background = OxyColors.White };
                //    pngExporter.Export(model, stream);
                //    stream.Position = 0; // 重置流的位置到开头

                //    // 添加图片部分
                //    ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png);
                //    imagePart.FeedData(stream);

                //    // 获取图片部分的关系ID
                //    string relId = mainPart.GetIdOfPart(imagePart);

                //    // 页面宽度（8.5英寸）转换为EMU
                //    long pageWidthEmu = (long)(5.8 * 914400); // 8.5 inches in EMU

                //    // 计算图片的高度以保持宽高比
                //    long imageHeightEmu = (long)((double)pageWidthEmu / 800 * 300); // 保持宽高比

                //    // 创建内联图形
                //    DW.Inline inline = new DW.Inline(
                //        new DW.Extent() { Cx = pageWidthEmu, Cy = imageHeightEmu }, // 宽度和高度，单位为EMU
                //        new DW.EffectExtent()
                //        {
                //            LeftEdge = 0L,
                //            TopEdge = 0L,
                //            RightEdge = 0L,
                //            BottomEdge = 0L
                //        },
                //        new DW.DocProperties()
                //        {
                //            Id = (UInt32Value)1U,
                //            Name = "Chart Image"
                //        },
                //        new DW.NonVisualGraphicFrameDrawingProperties(
                //            new A.GraphicFrameLocks() { NoChangeAspect = true }),
                //        new A.Graphic(
                //            new A.GraphicData(
                //                new PIC.Picture(
                //                    new PIC.NonVisualPictureProperties(
                //                        new PIC.NonVisualDrawingProperties()
                //                        {
                //                            Id = (UInt32Value)0U,
                //                            Name = "Chart Image.png"
                //                        },
                //                        new PIC.NonVisualPictureDrawingProperties()),
                //                    new PIC.BlipFill(
                //                        new A.Blip(new A.BlipExtensionList(
                //                            new A.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }))
                //                        {
                //                            Embed = relId,
                //                            CompressionState = A.BlipCompressionValues.Print
                //                        },
                //                        new A.Stretch(new A.FillRectangle())),
                //                    new PIC.ShapeProperties(
                //                        new A.Transform2D(
                //                            new A.Offset() { X = 0L, Y = 0L },
                //                            new A.Extents() { Cx = 914400L, Cy = 685800L }),
                //                        new A.PresetGeometry(new A.AdjustValueList()) { Preset = A.ShapeTypeValues.Rectangle }))
                //            )
                //            { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }
                //        )
                //)
                //    { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)0U, DistanceFromRight = (UInt32Value)0U, EditId = "50D07946" };

                //    // 创建一个段落并添加内联图形
                //    Paragraph para = new Paragraph(new Run(new Drawing(inline)));
                //    mainPart.Document.Body.Append(para);

                //}

                //#endregion

                #endregion

                // 5.整机检测结论：
                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
                paragraphProperties = new ParagraphProperties();
                numberingProperties = new NumberingProperties();
                numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
                numberingProperties.NumberingId = new NumberingId() { Val = 1 };
                paragraphProperties.Append(numberingProperties);
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("整机检测结论："));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落
                // 创建段落属性
                paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                indentation = new Indentation()
                {
                    FirstLine = "1000" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("根据检测标准检测本仪器         合格"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落
                // 创建段落属性
                paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                indentation = new Indentation()
                {
                    FirstLine = "1000" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("产品检验：                     检测员："));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


                paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落
                // 创建段落属性
                paragraphProperties = new ParagraphProperties();
                // 创建缩进属性
                indentation = new Indentation()
                {
                    FirstLine = "1000" // 首行缩进量，单位为twips（1/20点）
                };
                // 将缩进属性添加到段落属性中
                paragraphProperties.Append(indentation);
                // 将段落属性添加到段落中
                paragraph.Append(paragraphProperties);
                body.AppendChild(paragraph);
                run = paragraph.AppendChild(new Run());
                run.AppendChild(new Text("北京通为科技有限公司"));
                run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
                run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

                // 保存文档
                mainPart.Document.Save();
            }
        }

        private static Stream GetResourceStream(string resourceName)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            return assembly.GetManifestResourceStream(resourceName);
        }

        public static void AddHeaderWithImage(MainDocumentPart mainPart,string resourceImageName)
        {
            // 创建页眉部分
            HeaderPart headerPart = mainPart.AddNewPart<HeaderPart>();
            string headerPartId = mainPart.GetIdOfPart(headerPart);

            // 将图片添加到页眉
            ImagePart imagePart = headerPart.AddImagePart(ImagePartType.Png);
            //using(FileStream stream = new FileStream(imagePath, FileMode.Open))
            //{
            //    imagePart.FeedData(stream);
            //}
            using (Stream resourceStream = GetResourceStream(resourceImageName))
            {
                if (resourceStream == null)
                {
                    throw new FileNotFoundException("Resource image not found.", resourceImageName);
                }
                imagePart.FeedData(resourceStream);
            }

            // 生成图片的唯一ID
            string imageId = headerPart.GetIdOfPart(imagePart);

            // 创建页眉内容
            Header header = new Header(
                new Paragraph(
                    new Run(
                        new Drawing(
                            new DW.Inline(
                                new DW.Extent() { Cx = 1500000L,Cy= 300000L},  // 设置图片大小
                                new DW.EffectExtent()
                                {
                                    LeftEdge = 0L,
                                    TopEdge = 0L,
                                    RightEdge = 0L,
                                    BottomEdge = 0L
                                },
                                new DW.DocProperties()
                                {
                                    Id = 1U,
                                    Name = "Header Image"
                                },
                                new DW.NonVisualGraphicFrameDrawingProperties(
                                    new A.GraphicFrameLocks() { NoChangeAspect = true }),
                                new A.Graphic(
                                    new A.GraphicData(
                                        new PIC.Picture(
                                            new PIC.NonVisualPictureProperties(
                                                new PIC.NonVisualDrawingProperties() { Id = 0U, Name = "Header Image"},
                                                new PIC.NonVisualPictureDrawingProperties()
                                                ),
                                            new PIC.BlipFill(
                                                new A.Blip() { Embed = imageId},
                                                new A.Stretch(new A.FillRectangle())
                                                ),
                                            new PIC.ShapeProperties(
                                                new A.Transform2D(
                                                    new A.Offset() { X = 0L, Y = 0L},
                                                    new A.Extents() { Cx = 15000000L,Cy=300000L}
                                                    ),
                                                new A.PresetGeometry(new A.AdjustValueList()) { Preset = A.ShapeTypeValues.Rectangle}
                                                )
                                            )
                                        )
                                    {
                                        Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture"
                                    }
                                    )
                                )
                            {
                                DistanceFromTop = 0,
                                DistanceFromBottom = 0,
                                DistanceFromLeft = 0,
                                DistanceFromRight = 0
                            }
                            )
                        )
                    )
                );

            // 将页眉添加到页眉部分
            headerPart.Header = header;

            // 获取文档的节属性
            SectionProperties sectionProperties = mainPart.Document.Body.Descendants<SectionProperties>().LastOrDefault();
            if (sectionProperties == null)
            {
                sectionProperties = new SectionProperties();
                mainPart.Document.Body.Append(sectionProperties);
            }

            // 添加页眉引用并断开与前一节的链接
            HeaderReference headerReference = new HeaderReference() { Type = HeaderFooterValues.Default, Id = headerPartId };
            sectionProperties.Append(headerReference);

            // 断开页眉链接
            sectionProperties.Append(new TitlePage());
        }


        public static void CreateSpectrumChart(MainDocumentPart mainPart, Body body, DeviceInfo deviceInfo, string title,Dictionary<string,string> spectrumPathDic,ProcessStep step)
        {
            // 1)无光栅光谱TV1600-模块图：
            Paragraph paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
            ParagraphProperties paragraphProperties = new ParagraphProperties();
            NumberingProperties numberingProperties = new NumberingProperties();
            numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
            numberingProperties.NumberingId = new NumberingId() { Val = 2 };
            paragraphProperties.Append(numberingProperties);
            paragraph.Append(paragraphProperties);
            body.AppendChild(paragraph);
            Run run = paragraph.AppendChild(new Run());
            run.AppendChild(new Text(title));
            run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
            run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


            #region 图表
            string spectrumData = "";
            int channelNo = 0;
            if (spectrumPathDic.ContainsKey("0_"+(int)step))
            {
                spectrumData = spectrumPathDic["0_" + (int)step];
                channelNo = 0;
            }
            else
            {
                for (int i = 0; i < deviceInfo.deviceParam.nChannel; i++)
                {
                    if (spectrumPathDic.ContainsKey((i + 1) + "_" + (int)step))
                    {
                        spectrumData = spectrumPathDic[(i + 1) + "_" + (int)step];
                        channelNo = i + 1;
                        break;
                    }
                }
            }


            // 创建 OxyPlot 图表模型
            var model = new PlotModel { Title = title };

            // 设置图例位置和放置方式
            model.LegendPosition = LegendPosition.RightTop; // 图例位于右上角
            model.LegendPlacement = LegendPlacement.Outside; // 图例放置在图表外部

            var xAxis = new OxyPlot.Axes.LinearAxis
            {
                Position = OxyPlot.Axes.AxisPosition.Bottom,
                Title = "波长（pm）",
                // 设置刻度标签格式为小数点后两位
                //StringFormat = "0.00"
            };

            model.Axes.Add(xAxis);

            var yAxis = new OxyPlot.Axes.LinearAxis
            {
                Position = OxyPlot.Axes.AxisPosition.Left,
                Minimum = -75,  // 设置Y轴的最小值
                Maximum = 0, // 设置Y轴的最大值,
                MajorStep = 5,  // 设置主要刻度间隔
                Title = "强度（dBm）",
                //AxisTickToLabelDistance = 20, // 设置标签距离轴的距离，单位是屏幕像素
                AxisTitleDistance = 20
            };

            model.Axes.Add(yAxis);


            OxyPlot.Series.LineSeries series = null;

            if (channelNo == 0)
            {
                using (FileStream fileStream = new FileStream(spectrumData, FileMode.Open, FileAccess.Read))
                {
                    // 创建BinaryReader实例
                    using (BinaryReader br = new BinaryReader(fileStream))
                    {

                        int channelNum = br.ReadInt32();
                        for (int m = 0; m < channelNum; m++)
                        {
                            List<DataPoint> dataPoints = new List<DataPoint>();
                            int cNo = br.ReadInt32();
                            int dataCount = br.ReadInt32();
                            //long count = fileStream.Length/16;
                            for (long i = 0; i < dataCount; i++)
                            {
                                DataPoint point = new DataPoint(br.ReadDouble(), br.ReadDouble());
                                dataPoints.Add(point);
                            }

                            series = new OxyPlot.Series.LineSeries
                            {
                                Title = "通道" + cNo,
                                MarkerType = MarkerType.None,
                                ItemsSource = dataPoints
                            };
                            model.Series.Add(series);
                        }

                    }
                }
            }
            else
            {
                List<DataPoint> dataPoints = new List<DataPoint>();
                using (FileStream fileStream = new FileStream(spectrumData, FileMode.Open, FileAccess.Read))
                {
                    // 创建BinaryReader实例
                    using (BinaryReader br = new BinaryReader(fileStream))
                    {
                        int channelNum = br.ReadInt32();
                        int cNo = br.ReadInt32();
                        int dataCount = br.ReadInt32();
                        //long count = fileStream.Length/16;
                        for (long i = 0; i < dataCount; i++)
                        {
                            DataPoint point = new DataPoint(br.ReadDouble(), br.ReadDouble());
                            dataPoints.Add(point);
                        }

                        series = new OxyPlot.Series.LineSeries
                        {
                            Title = "通道" + cNo,
                            MarkerType = MarkerType.None,
                            ItemsSource = dataPoints
                        };
                        model.Series.Add(series);
                    }
                }
            }



            //// 添加数据系列（例如线图系列）
            //series = new OxyPlot.Series.LineSeries
            //{
            //    Title = "通道2",
            //    MarkerType = MarkerType.Circle,
            //    ItemsSource = new List<DataPoint>
            //    {
            //        new DataPoint(0, 15),
            //        new DataPoint(10, 12),
            //        new DataPoint(20, 24)
            //    }
            //};
            //model.Series.Add(series);

            // 将图表渲染为图片
            using (var stream = new MemoryStream())
            {
                var pngExporter = new OxyPlot.Wpf.PngExporter { Width = 800, Height = 300, Background = OxyColors.White };
                pngExporter.Export(model, stream);
                stream.Position = 0; // 重置流的位置到开头

                // 添加图片部分
                ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png);
                imagePart.FeedData(stream);

                // 获取图片部分的关系ID
                string relId = mainPart.GetIdOfPart(imagePart);

                // 页面宽度（8.5英寸）转换为EMU
                long pageWidthEmu = (long)(5.8 * 914400); // 8.5 inches in EMU

                // 计算图片的高度以保持宽高比
                long imageHeightEmu = (long)((double)pageWidthEmu / 800 * 300); // 保持宽高比

                // 创建内联图形
                DW.Inline inline = new DW.Inline(
                    new DW.Extent() { Cx = pageWidthEmu, Cy = imageHeightEmu }, // 宽度和高度，单位为EMU
                    new DW.EffectExtent()
                    {
                        LeftEdge = 0L,
                        TopEdge = 0L,
                        RightEdge = 0L,
                        BottomEdge = 0L
                    },
                    new DW.DocProperties()
                    {
                        Id = (UInt32Value)1U,
                        Name = "Chart Image"
                    },
                    new DW.NonVisualGraphicFrameDrawingProperties(
                        new A.GraphicFrameLocks() { NoChangeAspect = true }),
                    new A.Graphic(
                        new A.GraphicData(
                            new PIC.Picture(
                                new PIC.NonVisualPictureProperties(
                                    new PIC.NonVisualDrawingProperties()
                                    {
                                        Id = (UInt32Value)0U,
                                        Name = "Chart Image.png"
                                    },
                                    new PIC.NonVisualPictureDrawingProperties()),
                                new PIC.BlipFill(
                                    new A.Blip(new A.BlipExtensionList(
                                        new A.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }))
                                    {
                                        Embed = relId,
                                        CompressionState = A.BlipCompressionValues.Print
                                    },
                                    new A.Stretch(new A.FillRectangle())),
                                new PIC.ShapeProperties(
                                    new A.Transform2D(
                                        new A.Offset() { X = 0L, Y = 0L },
                                        new A.Extents() { Cx = 914400L, Cy = 685800L }),
                                    new A.PresetGeometry(new A.AdjustValueList()) { Preset = A.ShapeTypeValues.Rectangle }))
                        )
                        { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }
                    )
            )
                { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)0U, DistanceFromRight = (UInt32Value)0U, EditId = "50D07946" };

                // 创建一个段落并添加内联图形
                Paragraph para = new Paragraph(new Run(new Drawing(inline)));
                mainPart.Document.Body.Append(para);

            }

            #endregion

            body.AppendChild(new Paragraph());
            body.AppendChild(new Paragraph());
        }

        public static void CreateDataAcquisitionChart(MainDocumentPart mainPart, Body body, DeviceInfo deviceInfo, string title, ProcessStep step)
        {
            Paragraph paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
            ParagraphProperties paragraphProperties = new ParagraphProperties();
            NumberingProperties numberingProperties = new NumberingProperties();
            numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
            numberingProperties.NumberingId = new NumberingId() { Val = 2 };
            paragraphProperties.Append(numberingProperties);
            paragraph.Append(paragraphProperties);
            body.AppendChild(paragraph);
            Run run = paragraph.AppendChild(new Run());
            run.AppendChild(new Text(title));
            run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
            run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };


            #region 图表

            CollectDataCollection collection = new CollectDataCollection();
            collection.Load(deviceInfo.serialNo,step);


            // 创建 OxyPlot 图表模型
            var model = new PlotModel { Title = title};

            // 设置图例位置和放置方式
            model.LegendPosition = LegendPosition.RightTop; // 图例位于右上角
            model.LegendPlacement = LegendPlacement.Outside; // 图例放置在图表外部
            model.IsLegendVisible = false;

            //var xAxis = new OxyPlot.Axes.LinearAxis
            //{
            //    Position = OxyPlot.Axes.AxisPosition.Bottom,
            //    Title = "波长（pm）",
            //    // 设置刻度标签格式为小数点后两位
            //    //StringFormat = "0.00"
            //};

            //model.Axes.Add(xAxis);

            var yAxis = new OxyPlot.Axes.LinearAxis
            {
                Position = OxyPlot.Axes.AxisPosition.Left,
                Minimum = -75,  // 设置Y轴的最小值
                Maximum = 0, // 设置Y轴的最大值,
                MajorStep = 5,  // 设置主要刻度间隔
                Title = "波长（pm）",
                //AxisTickToLabelDistance = 20, // 设置标签距离轴的距离，单位是屏幕像素
                AxisTitleDistance = 20
            };

            model.Axes.Add(yAxis);


            OxyPlot.Series.LineSeries series = null;

            double minValue = double.MaxValue;
            double maxValue = double.MinValue;
            collection.ForEach(x =>
            {
                int channelNo = x.channelNo;
                int gratingNo = x.gratingNo;
                List<DataPoint> dataPoints = new List<DataPoint>();

                for (long i = 0; i < x.values.Count; i++)
                {
                    double value = x.values[(int)i];
                    DataPoint point = new DataPoint(i, value);
                    dataPoints.Add(point);
                    if(value > maxValue)
                    {
                        maxValue = value;
                    }
                    if(value < minValue)
                    {
                        minValue = value;
                    }
                }

                series = new OxyPlot.Series.LineSeries
                {
                    Title = "通道" + channelNo + "光栅" + gratingNo,
                    MarkerType = MarkerType.None,
                    ItemsSource = dataPoints
                };
                model.Series.Add(series);
                
                return false;
            });

            double diffValue = maxValue - minValue;
            if (diffValue < 0.02) diffValue = 0.02;
            yAxis.Minimum = minValue-diffValue*0.25;
            yAxis.Maximum = maxValue+diffValue*0.25;




            //// 添加数据系列（例如线图系列）
            //series = new OxyPlot.Series.LineSeries
            //{
            //    Title = "通道2",
            //    MarkerType = MarkerType.Circle,
            //    ItemsSource = new List<DataPoint>
            //    {
            //        new DataPoint(0, 15),
            //        new DataPoint(10, 12),
            //        new DataPoint(20, 24)
            //    }
            //};
            //model.Series.Add(series);

            // 将图表渲染为图片
            using (var stream = new MemoryStream())
            {
                var pngExporter = new OxyPlot.Wpf.PngExporter { Width = 800, Height = 300, Background = OxyColors.White };
                pngExporter.Export(model, stream);
                stream.Position = 0; // 重置流的位置到开头

                // 添加图片部分
                ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png);
                imagePart.FeedData(stream);

                // 获取图片部分的关系ID
                string relId = mainPart.GetIdOfPart(imagePart);

                // 页面宽度（8.5英寸）转换为EMU
                long pageWidthEmu = (long)(5.8 * 914400); // 8.5 inches in EMU

                // 计算图片的高度以保持宽高比
                long imageHeightEmu = (long)((double)pageWidthEmu / 800 * 300); // 保持宽高比

                // 创建内联图形
                DW.Inline inline = new DW.Inline(
                    new DW.Extent() { Cx = pageWidthEmu, Cy = imageHeightEmu }, // 宽度和高度，单位为EMU
                    new DW.EffectExtent()
                    {
                        LeftEdge = 0L,
                        TopEdge = 0L,
                        RightEdge = 0L,
                        BottomEdge = 0L
                    },
                    new DW.DocProperties()
                    {
                        Id = (UInt32Value)1U,
                        Name = "Chart Image"
                    },
                    new DW.NonVisualGraphicFrameDrawingProperties(
                        new A.GraphicFrameLocks() { NoChangeAspect = true }),
                    new A.Graphic(
                        new A.GraphicData(
                            new PIC.Picture(
                                new PIC.NonVisualPictureProperties(
                                    new PIC.NonVisualDrawingProperties()
                                    {
                                        Id = (UInt32Value)0U,
                                        Name = "Chart Image.png"
                                    },
                                    new PIC.NonVisualPictureDrawingProperties()),
                                new PIC.BlipFill(
                                    new A.Blip(new A.BlipExtensionList(
                                        new A.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" }))
                                    {
                                        Embed = relId,
                                        CompressionState = A.BlipCompressionValues.Print
                                    },
                                    new A.Stretch(new A.FillRectangle())),
                                new PIC.ShapeProperties(
                                    new A.Transform2D(
                                        new A.Offset() { X = 0L, Y = 0L },
                                        new A.Extents() { Cx = 914400L, Cy = 685800L }),
                                    new A.PresetGeometry(new A.AdjustValueList()) { Preset = A.ShapeTypeValues.Rectangle }))
                        )
                        { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" }
                    )
            )
                { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)0U, DistanceFromRight = (UInt32Value)0U, EditId = "50D07946" };

                // 创建一个段落并添加内联图形
                Paragraph para = new Paragraph(new Run(new Drawing(inline)));
                mainPart.Document.Body.Append(para);

            }

            #endregion

            body.AppendChild(new Paragraph());
            body.AppendChild(new Paragraph());
        }

        public static void CreateEtalonTable(MainDocumentPart mainPart, Body body, DeviceInfo deviceInfo, string title, ProcessStep step)
        {
            Paragraph paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
            ParagraphProperties paragraphProperties = new ParagraphProperties();
            NumberingProperties numberingProperties = new NumberingProperties();
            numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
            numberingProperties.NumberingId = new NumberingId() { Val = 2 };
            paragraphProperties.Append(numberingProperties);
            paragraph.Append(paragraphProperties);
            body.AppendChild(paragraph);
            Run run = paragraph.AppendChild(new Run());
            run.AppendChild(new Text(title));
            run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
            run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

            // 添加产品信息表格
            Table table = body.AppendChild(new Table());

            #region 表格属性
            // 创建表格属性
            TableProperties tableProperties = new TableProperties();

            #region 表格宽度
            // 创建表格宽度属性
            TableWidth tableWidth = new TableWidth()
            {
                Width = "5000", // 表格宽度，单位为twips（1/20点）
                Type = TableWidthUnitValues.Pct // 宽度单位，这里设置为百分比
            };
            // 将表格宽度属性添加到表格属性中
            tableProperties.Append(tableWidth);
            #endregion

            #region 表格边框
            // 创建表格边框
            TableBorders tableBorders = new TableBorders();

            // 定义边框样式
            Border borderStyle = new Border()
            {
                Val = BorderValues.Single, // 单实线
                Size = 4, // 边框宽度，单位为1/8点
                Color = "000000", // 边框颜色，黑色
                Space = new UInt32Value((uint)24) // 边框与内容之间的空间，单位为pt
            };

            // 应用边框样式到所有边框
            tableBorders.TopBorder = new TopBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
            tableBorders.BottomBorder = new BottomBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
            tableBorders.LeftBorder = new LeftBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
            tableBorders.RightBorder = new RightBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
            tableBorders.InsideHorizontalBorder = new InsideHorizontalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };
            tableBorders.InsideVerticalBorder = new InsideVerticalBorder() { Val = BorderValues.Single, Size = borderStyle.Size, Color = borderStyle.Color, Space = borderStyle.Space };

            // 将表格边框添加到表格属性中
            tableProperties.Append(tableBorders);
            #endregion

            // 将表格属性添加到表格中
            table.Append(tableProperties);

            #endregion

            #region 第一行
            // 添加第一行
            TableRow tableRow = table.AppendChild(new TableRow());
            TableCell tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            TableCellMargin margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            TableCellProperties cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            Shading shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            TableCellVerticalAlignment cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            TableCellWidth tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            RunProperties runProperties = new RunProperties();
            FontSize fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            Text text = new Text("序号");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            Justification justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);


            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("通道号");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);

            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("光栅号");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);


            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("标准值");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);

            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("检测值");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);



            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("误差值");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);

            tableCell = tableRow.AppendChild(new TableCell());
            // 创建表格边框与内容的距离
            margin = new TableCellMargin();
            margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
            margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
            margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
            margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                      // 将边距应用到单元格属性
            cellProperties = new TableCellProperties();
            // 创建一个Shading对象并设置背景颜色
            shading = new Shading()
            {
                Val = ShadingPatternValues.Clear,
                Color = "auto",
                Fill = "CFCECE" // 红色背景，格式为灰色
            };
            cellProperties.Append(shading);
            // 设置垂直居中
            cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
            cellProperties.Append(cellVerticalAlignment);
            cellProperties.Append(margin);
            tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
            cellProperties.Append(tableCellWidth);
            tableCell.Append(cellProperties);
            runProperties = new RunProperties();
            fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
            runProperties.Append(fontSize);
            run = new Run();
            text = new Text("结论");
            run.Append(runProperties);
            run.Append(text);
            paragraph = new Paragraph(run);
            // 创建ParagraphProperties并设置居中对齐
            paragraphProperties = new ParagraphProperties();
            justification = new Justification() { Val = JustificationValues.Center };
            paragraphProperties.Append(justification);
            paragraph.Append(paragraphProperties);
            tableCell.AppendChild(paragraph);
            #endregion

            CompareCollection collection = new CompareCollection();
            collection.Load(deviceInfo.serialNo,step);

            int index = 1;
            collection.ForEach(x =>
            {
                // 添加一行
                tableRow = table.AppendChild(new TableRow());
                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(index.ToString());
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(x.channelNo.ToString());
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(x.gratingNo.ToString());
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(x.srcValue.ToString("F3"));
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(x.dstValue.ToString("F3"));
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "800", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text(x.diffValue.ToString("F3"));
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                tableCell = tableRow.AppendChild(new TableCell());
                // 创建表格边框与内容的距离
                margin = new TableCellMargin();
                margin.LeftMargin = new LeftMargin() { Width = "100" }; // 设置左边距，单位是八分之一点
                margin.RightMargin = new RightMargin() { Width = "100" }; // 设置右边距
                margin.TopMargin = new TopMargin() { Width = "0" }; // 设置顶边距
                margin.BottomMargin = new BottomMargin() { Width = "0" }; // 设置底边距
                                                                          // 将边距应用到单元格属性
                cellProperties = new TableCellProperties();
                // 设置垂直居中
                cellVerticalAlignment = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
                cellProperties.Append(cellVerticalAlignment);
                cellProperties.Append(margin);
                tableCellWidth = new TableCellWidth() { Width = "500", Type = TableWidthUnitValues.Pct };
                cellProperties.Append(tableCellWidth);
                tableCell.Append(cellProperties);
                runProperties = new RunProperties();
                fontSize = new FontSize() { Val = "24" }; // 字体大小，单位为半点（half-points）
                runProperties.Append(fontSize);
                run = new Run();
                text = new Text("合格");
                run.Append(runProperties);
                run.Append(text);
                paragraph = new Paragraph(run);
                // 创建ParagraphProperties并设置居中对齐
                paragraphProperties = new ParagraphProperties();
                justification = new Justification() { Val = JustificationValues.Center };
                paragraphProperties.Append(justification);
                paragraph.Append(paragraphProperties);
                tableCell.AppendChild(paragraph);


                index++;

                return false;
            });

            body.AppendChild(new Paragraph());
            body.AppendChild(new Paragraph());
        }

        public static void CreateContinuousDetection(MainDocumentPart mainPart, Body body, DeviceInfo deviceInfo, string title, ProcessStep step)
        {
            Paragraph paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居中段落
            ParagraphProperties paragraphProperties = new ParagraphProperties();
            NumberingProperties numberingProperties = new NumberingProperties();
            numberingProperties.NumberingLevelReference = new NumberingLevelReference() { Val = 0 };
            numberingProperties.NumberingId = new NumberingId() { Val = 2 };
            paragraphProperties.Append(numberingProperties);
            paragraph.Append(paragraphProperties);
            body.AppendChild(paragraph);
            Run run = paragraph.AppendChild(new Run());
            run.AppendChild(new Text(title));
            run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
            run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

            body.AppendChild(new Paragraph());

            GlobalSetting setting = new GlobalSetting();
            setting.Load(deviceInfo.serialNo);
            string msg = string.Format("设备共烤机{0}小时，未发现异常。",setting.continuousRunTime);


            paragraph = new Paragraph(new ParagraphProperties(new Justification() { Val = JustificationValues.Left })); // 居左段落                                                                                                  // 创建段落属性
            paragraphProperties = new ParagraphProperties();
            // 创建缩进属性
            Indentation indentation = new Indentation()
            {
                FirstLine = "800" // 首行缩进量，单位为twips（1/20点）
            };
            // 将缩进属性添加到段落属性中
            paragraphProperties.Append(indentation);
            // 将段落属性添加到段落中
            paragraph.Append(paragraphProperties);
            body.AppendChild(paragraph);
            run = paragraph.AppendChild(new Run());
            run.AppendChild(new Text(msg));
            run.RunProperties = new RunProperties(new RunFonts { Ascii = "宋体", HighAnsi = "宋体", ComplexScript = "宋体" });
            run.RunProperties.FontSize = new FontSize { Val = (16 * 2).ToString() };

            body.AppendChild(new Paragraph());
            body.AppendChild(new Paragraph());
        }
    }
}
